namespace CookieTerm.MdiTabStrip
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    public class MdiNewTab : MdiTab
    {

        public MdiNewTab(MdiTabStrip owner)
            : base(owner)
        {
        }

        internal override void DrawControl(System.Drawing.Graphics g)
        {
            Image tabImage = default(Image);

            if (this.ParentInternal.MdiNewTabImage == null)
            {
                tabImage = Resources.NewTab;
            }
            else
            {
                tabImage = this.ParentInternal.MdiNewTabImage;
            }

            if (this.IsMouseOver)
            {
                Rectangle iconRectangle = new Rectangle(this.Width / 2 - tabImage.Width / 2, this.Height / 2 - tabImage.Height / 2, tabImage.Width, tabImage.Height);

                iconRectangle.Offset(this.Location);
                g.DrawImage(tabImage, iconRectangle);
            }
        }

        protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            this.ParentInternal.OnMdiNewTabClick();
        }

        protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
        {
            //Not implemented but overriden to bypass behavior in inherited class.
        }

        protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            //Not implemented but overriden to bypass behavior in inherited class.
        }
    }

    //=======================================================
    //Service provided by Telerik (www.telerik.com)
    //Conversion powered by NRefactory.
    //Twitter: @telerik
    //Facebook: facebook.com/telerik
    //=======================================================
}